unit udlgNewCatalog;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
  System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, udlgRenameCatalog, FMX.Edit, FMX.Objects, FMX.Layouts,
  uProjectDic;

type

  TdlgNewCatalog = class(TdlgRenameCatalog)
  protected
    procedure DoOkClick(); override;
  public
  end;

  function dlgNewCatalog(AOwner: TFmxObject): TProjectDic;


implementation

{$R *.fmx}



function dlgNewCatalog(AOwner: TFmxObject): TProjectDic;
var
  dlgNewCatalog: TdlgNewCatalog;
begin
  dlgNewCatalog:= TdlgNewCatalog.Create(AOwner);
  dlgNewCatalog.PrepareView(nil);
  dlgNewCatalog.ShowModal;
  if dlgNewCatalog.Ok then
    result:= dlgNewCatalog.ProjectDic
  else
    result:= nil;
  dlgNewCatalog.Free;
end;


{ TdlgNewCatalog }

procedure TdlgNewCatalog.DoOkClick;
begin
  if not CheckInput( True ) then begin
    eName.SetFocus;
    exit;
  end;

  FProjectDic:= dicProjectCatalogs.dbAdd( eName.Text );
  Fok:= True;
  Close;
end;

end.
